#!/usr/bin/perl
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
#  
#  
# Licensed Materials - Property of IBM 
#  
# Restricted Materials of IBM 
#  
# (C) COPYRIGHT International Business Machines Corp. 2003,2004 
# All Rights Reserved 
#  
# US Government Users Restricted Rights - Use, duplication or 
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp. 
#  
# IBM_PROLOG_END_TAG 
####################################################################
#
#   lsadptucode command
#
#   Syntax: lsadptucode
#
#	No parameters
#
####################################################################
#
#   Initial version - 04/16/03
#
####################################################################

sub exit_routine {
    
     # remove files from /tmp 
     
     exit $ret; 

} # end exit_routine subroutine


################################################################################
#
# start main body of code
#
################################################################################
$PRGRM  = "lsadptucode";
$BIN    = "/opt/hsc/bin"; 
$PARMS = 0;

$USAGE = "Usage: lsadptucode\n";

# First check for existence of parameters
if ($#ARGV ne -1) {
	$PARMS = 1;
}

if ($PARMS == 1)
{
#  	Parameters specified
#	print "Parameters specified\n";     #DEBUG
		print $USAGE;      #USAGE
		$ret = 1;
		&exit_routine;
}

chop($RC = `$BIN/i_stub_FS adptucode -P`);
if ($RC==50)
{
	print "Cannot connect to FNM Daemon\n";
}
elsif ($RC==52)
{
	print "Device Database not available\n";
}
else 
{
	print "Current adapter microcode levels:\n";
	print "[frame] [cage] [timestamp]\n";
	system "$BIN/i_stub_FS adptucode -P";
}
	
$ret = 0;
$exit_routine;
